Guard definition of alloca(). glib.h now handles that.
authorTor Lillqvist <tml@iki.fi>
Tue, 3 Oct 2000 21:00:49 +0000 (21:00 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Tue, 3 Oct 2000 21:00:49 +0000 (21:00 +0000)
2000-10-03  Tor Lillqvist  <tml@iki.fi>

* config.h.win32: Guard definition of alloca(). glib.h now handles
that.

* gdk/gdk.def
* gtk/gtk.def: Add new entry points.

Changes just to make GTK+ build without errors on Win32. No hope
of it working in its current state, though...:

* gdk/win32/gdkselection-win32.c: Remove gcc -Wall warnings.  Add
some functions from the X11 backend, just to make GTK+ build.

* gdk/makefile.mingw.in
* gtk/makefile.mingw.in: Use correct gdk_pixbuf version
number. Add new object files.

* gtk/gtkclipboard.c: Include gdkwin32.h on Win32. Use
GetMessageTime to get timestamp (where on X11 uses
gdk_x11_get_server_time()).

14 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
config.h.win32
gdk/gdk.def
gdk/makefile.mingw.in
gdk/win32/gdkselection-win32.c
gtk/gtk.def
gtk/gtkclipboard.c
gtk/makefile.mingw.in

index 5178f1dae909050a17a608836f7e53fd36d55c8a..fd445db511271c4f1db26406f2ca3f65a99a21ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2000-10-03  Tor Lillqvist  <tml@iki.fi>
+
+       * config.h.win32: Guard definition of alloca(). glib.h now handles
+       that.
+
+       * gdk/gdk.def
+       * gtk/gtk.def: Add new entry points.
+
+       Changes just to make GTK+ build without errors on Win32. No hope
+       of it working in its current state, though...:
+       
+       * gdk/win32/gdkselection-win32.c: Remove gcc -Wall warnings.  Add
+       some functions from the X11 backend, just to make GTK+ build.
+
+       * gdk/makefile.mingw.in
+       * gtk/makefile.mingw.in: Use correct gdk_pixbuf version
+       number. Add new object files.
+
+       * gtk/gtkclipboard.c: Include gdkwin32.h on Win32. Use
+       GetMessageTime to get timestamp (where on X11 uses
+       gdk_x11_get_server_time()).
+
 2000-10-02  Havoc Pennington  <hp@pobox.com>
 
        * gtk/gtktextview.c: text_window_* weren't static and should have
index 5178f1dae909050a17a608836f7e53fd36d55c8a..fd445db511271c4f1db26406f2ca3f65a99a21ad 100644 (file)
@@ -1,3 +1,25 @@
+2000-10-03  Tor Lillqvist  <tml@iki.fi>
+
+       * config.h.win32: Guard definition of alloca(). glib.h now handles
+       that.
+
+       * gdk/gdk.def
+       * gtk/gtk.def: Add new entry points.
+
+       Changes just to make GTK+ build without errors on Win32. No hope
+       of it working in its current state, though...:
+       
+       * gdk/win32/gdkselection-win32.c: Remove gcc -Wall warnings.  Add
+       some functions from the X11 backend, just to make GTK+ build.
+
+       * gdk/makefile.mingw.in
+       * gtk/makefile.mingw.in: Use correct gdk_pixbuf version
+       number. Add new object files.
+
+       * gtk/gtkclipboard.c: Include gdkwin32.h on Win32. Use
+       GetMessageTime to get timestamp (where on X11 uses
+       gdk_x11_get_server_time()).
+
 2000-10-02  Havoc Pennington  <hp@pobox.com>
 
        * gtk/gtktextview.c: text_window_* weren't static and should have
index 5178f1dae909050a17a608836f7e53fd36d55c8a..fd445db511271c4f1db26406f2ca3f65a99a21ad 100644 (file)
@@ -1,3 +1,25 @@
+2000-10-03  Tor Lillqvist  <tml@iki.fi>
+
+       * config.h.win32: Guard definition of alloca(). glib.h now handles
+       that.
+
+       * gdk/gdk.def
+       * gtk/gtk.def: Add new entry points.
+
+       Changes just to make GTK+ build without errors on Win32. No hope
+       of it working in its current state, though...:
+       
+       * gdk/win32/gdkselection-win32.c: Remove gcc -Wall warnings.  Add
+       some functions from the X11 backend, just to make GTK+ build.
+
+       * gdk/makefile.mingw.in
+       * gtk/makefile.mingw.in: Use correct gdk_pixbuf version
+       number. Add new object files.
+
+       * gtk/gtkclipboard.c: Include gdkwin32.h on Win32. Use
+       GetMessageTime to get timestamp (where on X11 uses
+       gdk_x11_get_server_time()).
+
 2000-10-02  Havoc Pennington  <hp@pobox.com>
 
        * gtk/gtktextview.c: text_window_* weren't static and should have
index 5178f1dae909050a17a608836f7e53fd36d55c8a..fd445db511271c4f1db26406f2ca3f65a99a21ad 100644 (file)
@@ -1,3 +1,25 @@
+2000-10-03  Tor Lillqvist  <tml@iki.fi>
+
+       * config.h.win32: Guard definition of alloca(). glib.h now handles
+       that.
+
+       * gdk/gdk.def
+       * gtk/gtk.def: Add new entry points.
+
+       Changes just to make GTK+ build without errors on Win32. No hope
+       of it working in its current state, though...:
+       
+       * gdk/win32/gdkselection-win32.c: Remove gcc -Wall warnings.  Add
+       some functions from the X11 backend, just to make GTK+ build.
+
+       * gdk/makefile.mingw.in
+       * gtk/makefile.mingw.in: Use correct gdk_pixbuf version
+       number. Add new object files.
+
+       * gtk/gtkclipboard.c: Include gdkwin32.h on Win32. Use
+       GetMessageTime to get timestamp (where on X11 uses
+       gdk_x11_get_server_time()).
+
 2000-10-02  Havoc Pennington  <hp@pobox.com>
 
        * gtk/gtktextview.c: text_window_* weren't static and should have
index 5178f1dae909050a17a608836f7e53fd36d55c8a..fd445db511271c4f1db26406f2ca3f65a99a21ad 100644 (file)
@@ -1,3 +1,25 @@
+2000-10-03  Tor Lillqvist  <tml@iki.fi>
+
+       * config.h.win32: Guard definition of alloca(). glib.h now handles
+       that.
+
+       * gdk/gdk.def
+       * gtk/gtk.def: Add new entry points.
+
+       Changes just to make GTK+ build without errors on Win32. No hope
+       of it working in its current state, though...:
+       
+       * gdk/win32/gdkselection-win32.c: Remove gcc -Wall warnings.  Add
+       some functions from the X11 backend, just to make GTK+ build.
+
+       * gdk/makefile.mingw.in
+       * gtk/makefile.mingw.in: Use correct gdk_pixbuf version
+       number. Add new object files.
+
+       * gtk/gtkclipboard.c: Include gdkwin32.h on Win32. Use
+       GetMessageTime to get timestamp (where on X11 uses
+       gdk_x11_get_server_time()).
+
 2000-10-02  Havoc Pennington  <hp@pobox.com>
 
        * gtk/gtktextview.c: text_window_* weren't static and should have
index 5178f1dae909050a17a608836f7e53fd36d55c8a..fd445db511271c4f1db26406f2ca3f65a99a21ad 100644 (file)
@@ -1,3 +1,25 @@
+2000-10-03  Tor Lillqvist  <tml@iki.fi>
+
+       * config.h.win32: Guard definition of alloca(). glib.h now handles
+       that.
+
+       * gdk/gdk.def
+       * gtk/gtk.def: Add new entry points.
+
+       Changes just to make GTK+ build without errors on Win32. No hope
+       of it working in its current state, though...:
+       
+       * gdk/win32/gdkselection-win32.c: Remove gcc -Wall warnings.  Add
+       some functions from the X11 backend, just to make GTK+ build.
+
+       * gdk/makefile.mingw.in
+       * gtk/makefile.mingw.in: Use correct gdk_pixbuf version
+       number. Add new object files.
+
+       * gtk/gtkclipboard.c: Include gdkwin32.h on Win32. Use
+       GetMessageTime to get timestamp (where on X11 uses
+       gdk_x11_get_server_time()).
+
 2000-10-02  Havoc Pennington  <hp@pobox.com>
 
        * gtk/gtktextview.c: text_window_* weren't static and should have
index 5178f1dae909050a17a608836f7e53fd36d55c8a..fd445db511271c4f1db26406f2ca3f65a99a21ad 100644 (file)
@@ -1,3 +1,25 @@
+2000-10-03  Tor Lillqvist  <tml@iki.fi>
+
+       * config.h.win32: Guard definition of alloca(). glib.h now handles
+       that.
+
+       * gdk/gdk.def
+       * gtk/gtk.def: Add new entry points.
+
+       Changes just to make GTK+ build without errors on Win32. No hope
+       of it working in its current state, though...:
+       
+       * gdk/win32/gdkselection-win32.c: Remove gcc -Wall warnings.  Add
+       some functions from the X11 backend, just to make GTK+ build.
+
+       * gdk/makefile.mingw.in
+       * gtk/makefile.mingw.in: Use correct gdk_pixbuf version
+       number. Add new object files.
+
+       * gtk/gtkclipboard.c: Include gdkwin32.h on Win32. Use
+       GetMessageTime to get timestamp (where on X11 uses
+       gdk_x11_get_server_time()).
+
 2000-10-02  Havoc Pennington  <hp@pobox.com>
 
        * gtk/gtktextview.c: text_window_* weren't static and should have
index 015e64ebbae895c70ffb5cc11266d08c974db9e2..ecbc5b3d5b1f84700c2440958b03f2453e3ab7a3 100755 (executable)
 
 /* Define if you have alloca, as a function or macro.  */
 #define HAVE_ALLOCA 1
-#ifdef _MSC_VER
-#define alloca _alloca
-#elif defined (__GNUC__)
-#define alloca __builtin_alloca
+#ifndef alloca
+  #ifdef _MSC_VER
+    #define alloca _alloca
+  #elif defined (__GNUC__)
+    #define alloca __builtin_alloca
+  #endif
 #endif
 
 /* Define if you have <alloca.h> and it should be used (not on Ultrix).  */
index f4d020d4e973bc0d9f45bb5e410251fc198abe16..9d63ae546ab9e98c15ee1fc33c7b14fcb0c31f10 100644 (file)
@@ -145,11 +145,11 @@ EXPORTS
        gdk_gc_new_with_values
        gdk_gc_ref
        gdk_gc_set_background
-       gdk_gc_set_colormap
        gdk_gc_set_clip_mask
        gdk_gc_set_clip_origin
        gdk_gc_set_clip_rectangle
        gdk_gc_set_clip_region
+       gdk_gc_set_colormap
        gdk_gc_set_dashes
        gdk_gc_set_exposures
        gdk_gc_set_fill
@@ -180,6 +180,7 @@ EXPORTS
        gdk_im_set_best_style
        gdk_image_get
        gdk_image_get_pixel
+       gdk_image_get_type
        gdk_image_new
        gdk_image_new_bitmap
        gdk_image_put_pixel
@@ -212,6 +213,10 @@ EXPORTS
        gdk_pango_context_get
        gdk_pango_context_set_colormap
        gdk_parent_root
+       gdk_pixbuf_render_pixmap_and_mask
+       gdk_pixbuf_render_threshold_alpha
+       gdk_pixbuf_render_to_drawable
+       gdk_pixbuf_render_to_drawable_alpha
        gdk_pixmap_colormap_create_from_xpm
        gdk_pixmap_colormap_create_from_xpm_d
        gdk_pixmap_create_from_data
@@ -284,12 +289,15 @@ EXPORTS
        gdk_text_height
        gdk_text_measure
        gdk_text_property_to_text_list
+       gdk_text_property_to_utf8_list
        gdk_text_width
        gdk_text_width_wc
        gdk_threads_enter
        gdk_threads_leave
        gdk_threads_mutex
        gdk_unicode_to_keyval
+       gdk_utf8_to_compound_text
+       gdk_utf8_to_string_target
        gdk_visual_get_best
        gdk_visual_get_best_depth
        gdk_visual_get_best_type
index b089d091287114202fa960e1291298e07d0c0637..09386e69d7e8abbfc3397770425513cb674065c7 100644 (file)
@@ -8,8 +8,11 @@ TOP = ../..
 
 include ../build/win32/make.mingw
 
-# Possibly override GTK+ version from build/win32/module.defs
+# Possibly override versions from build/win32/module.defs
 GTK_VER = @GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@
+GDK_PIXBUF_VER = @GDK_PIXBUF_MAJOR@.@GDK_PIXBUF_MINOR@
+
+GDK_PIXBUF_LIBS = -L ../gdk-pixbuf -lgdk_pixbuf-$(GDK_PIXBUF_VER)
 
 OPTIMIZE = -g
 
@@ -58,7 +61,7 @@ win32/gdk-win32res.o : FRC
        cd win32 && $(MAKE) -f makefile.mingw gdk-win32res.o
 
 gdk-win32-$(GTK_VER).dll : $(gdk_OBJECTS) gdk.def win32/libgdk-win32.a win32/gdk-win32res.o win32/libwntab32x.a
-       $(GLIB)/build-dll gdk-win32 $(GTK_VER) gdk.def $(gdk_OBJECTS) win32/libgdk-win32.a win32/libwntab32x.a -L ../gdk-pixbuf -lgdk_pixbuf-$(GTK_VER) $(GLIB_LIBS) $(PANGOWIN32_LIBS) -lgdi32 -luser32 -limm32 -lshell32 -lole32 -luuid $(LDFLAGS) win32/gdk-win32res.o
+       $(GLIB)/build-dll gdk-win32 $(GTK_VER) gdk.def $(gdk_OBJECTS) win32/libgdk-win32.a win32/libwntab32x.a $(GDK_PIXBUF_LIBS) $(GLIB_LIBS) $(PANGOWIN32_LIBS) -lgdi32 -luser32 -limm32 -lshell32 -lole32 -luuid $(LDFLAGS) win32/gdk-win32res.o
 
 win32/libwntab32x.a : FRC
        cd win32 && $(MAKE) -f makefile.mingw libwntab32x.a
@@ -67,7 +70,8 @@ win32/libwntab32x.a : FRC
 # makefile.mingw.in. Only for developer use.
 makefile.mingw: makefile.mingw.in
        sed -e 's,@GTK_MAJOR[_]VERSION@,@GTK_MAJOR_VERSION@,' \
-           -e 's,@GTK_MINOR[_]VERSION@,@GTK_MINOR_VERSION@,' <$< >$@
+           -e 's,@GTK_MINOR[_]VERSION@,@GTK_MINOR_VERSION@,' \
+           -e 's,@GDK_PIXBUF[_]MAJOR@,@GDK_PIXBUF_MAJOR@,'   \
+           -e 's,@GDK_PIXBUF[_]MINOR@,@GDK_PIXBUF_MINOR@,'   <$< >$@
 
 .PHONY: FRC
-
index 90f3cfdcba85a52f6e5ef1a58738bc8ec41afaee..bda364b8a8c9535c0f54fd54d1de00ceafd6b1c7 100644 (file)
@@ -90,8 +90,8 @@ gdk_selection_owner_set (GdkWindow *owner,
   GDK_NOTE (MISC,
            (sel_name = gdk_atom_name (selection),
             g_print ("gdk_selection_owner_set: %#x %#x (%s)\n",
-                     (owner ? GDK_WINDOW_HWND (owner) : 0),
-                     selection, sel_name),
+                     (owner ? (guint) GDK_WINDOW_HWND (owner) : 0),
+                     (guint) selection, sel_name),
             g_free (sel_name)));
 
   if (selection != gdk_clipboard_atom)
@@ -102,7 +102,7 @@ gdk_selection_owner_set (GdkWindow *owner,
   else
     xwindow = NULL;
 
-  GDK_NOTE (MISC, g_print ("...OpenClipboard(%#x)\n", xwindow));
+  GDK_NOTE (MISC, g_print ("...OpenClipboard(%#x)\n", (guint) xwindow));
   if (!OpenClipboard (xwindow))
     {
       WIN32_API_FAILED ("OpenClipboard");
@@ -161,8 +161,8 @@ gdk_selection_owner_get (GdkAtom selection)
   GDK_NOTE (MISC,
            (sel_name = gdk_atom_name (selection),
             g_print ("gdk_selection_owner_get: %#x (%s) = %#x\n",
-                     selection, sel_name,
-                     (window ? GDK_WINDOW_HWND (window) : 0)),
+                     (guint) selection, sel_name,
+                     (window ? (guint) GDK_WINDOW_HWND (window) : 0)),
             g_free (sel_name)));
 
   return window;
@@ -175,7 +175,6 @@ gdk_selection_convert (GdkWindow *requestor,
                       guint32    time)
 {
   HGLOBAL hdata;
-  GdkSelProp *prop;
   guchar *ptr, *data, *datap, *p;
   guint i, length, slength;
   gchar *sel_name, *tgt_name;
@@ -188,7 +187,9 @@ gdk_selection_convert (GdkWindow *requestor,
            (sel_name = gdk_atom_name (selection),
             tgt_name = gdk_atom_name (target),
             g_print ("gdk_selection_convert: %#x %#x (%s) %#x (%s)\n",
-                     GDK_WINDOW_HWND (requestor), selection, sel_name, target, tgt_name),
+                     (guint) GDK_WINDOW_HWND (requestor),
+                     (guint) selection, sel_name,
+                     (guint) target, tgt_name),
             g_free (sel_name),
             g_free (tgt_name)));
 
@@ -199,7 +200,7 @@ gdk_selection_convert (GdkWindow *requestor,
        * and store it for later.
        */
       GDK_NOTE (MISC, g_print ("...OpenClipboard(%#x)\n",
-                                   GDK_WINDOW_HWND (requestor)));
+                              (guint) GDK_WINDOW_HWND (requestor)));
       if (!OpenClipboard (GDK_WINDOW_HWND (requestor)))
        {
          WIN32_API_FAILED ("OpenClipboard");
@@ -295,7 +296,7 @@ gdk_selection_property_get (GdkWindow  *requestor,
     return 0;
   
   GDK_NOTE (MISC, g_print ("gdk_selection_property_get: %#x\n",
-                          GDK_WINDOW_HWND (requestor)));
+                          (guint) GDK_WINDOW_HWND (requestor)));
 
   prop = g_hash_table_lookup (sel_prop_table, &GDK_WINDOW_HWND (requestor));
 
@@ -345,9 +346,9 @@ gdk_selection_send_notify (guint32  requestor,
             prop_name = gdk_atom_name (property),
             g_print ("gdk_selection_send_notify: %#x %#x (%s) %#x (%s) %#x (%s)\n",
                      requestor,
-                     selection, sel_name,
-                     target, tgt_name,
-                     property, prop_name),
+                     (guint) selection, sel_name,
+                     (guint) target, tgt_name,
+                     (guint) property, prop_name),
             g_free (sel_name),
             g_free (tgt_name),
             g_free (prop_name)));
@@ -407,3 +408,314 @@ gdk_free_compound_text (guchar *ctext)
 {
   g_warning ("gdk_free_compound_text: Not implemented");
 }
+
+/* These are lifted from gdkselection-x11.c, just to get GTK+ to build.
+ * These functions probably don't make much sense at all in Windows.
+ */
+
+/* FIXME */
+
+static gint
+make_list (const gchar  *text,
+          gint          length,
+          gboolean      latin1,
+          gchar      ***list)
+{
+  GSList *strings = NULL;
+  gint n_strings = 0;
+  gint i;
+  const gchar *p = text;
+  const gchar *q;
+  GSList *tmp_list;
+  GError *error = NULL;
+
+  while (p < text + length)
+    {
+      gchar *str;
+      
+      q = p;
+      while (*q && q < text + length)
+       q++;
+
+      if (latin1)
+       {
+         str = g_convert (p, q - p,
+                          "UTF-8", "ISO-8859-1",
+                          NULL, NULL, &error);
+
+         if (!str)
+           {
+             g_warning ("Error converting selection from STRING: %s",
+                        error->message);
+             g_error_free (error);
+           }
+       }
+      else
+       str = g_strndup (p, q - p);
+
+      if (str)
+       {
+         strings = g_slist_prepend (strings, str);
+         n_strings++;
+       }
+
+      p = q + 1;
+    }
+
+  if (list)
+    *list = g_new (gchar *, n_strings + 1);
+
+  (*list)[n_strings] = NULL;
+  
+  i = n_strings;
+  tmp_list = strings;
+  while (tmp_list)
+    {
+      if (list)
+       (*list)[--i] = tmp_list->data;
+      else
+       g_free (tmp_list->data);
+
+      tmp_list = tmp_list->next;
+    }
+
+  g_slist_free (strings);
+
+  return n_strings;
+}
+
+/**
+ * gdk_text_property_to_utf8_list:
+ * @encoding: an atom representing the encoding of the text
+ * @format:   the format of the property
+ * @text:     the text to convert
+ * @length:   the length of @text, in bytes
+ * @list:     location to store the list of strings or %NULL. The
+ *            list should be freed with g_strfreev().
+ * 
+ * Convert a text property in the giving encoding to
+ * a list of UTF-8 strings. 
+ * 
+ * Return value: the number of strings in the resulting
+ *               list.
+ **/
+gint 
+gdk_text_property_to_utf8_list (GdkAtom        encoding,
+                               gint           format,
+                               const guchar  *text,
+                               gint           length,
+                               gchar       ***list)
+{
+  g_return_val_if_fail (text != NULL, 0);
+  g_return_val_if_fail (length >= 0, 0);
+  
+  if (encoding == GDK_TARGET_STRING)
+    {
+      return make_list ((gchar *)text, length, TRUE, list);
+    }
+  else if (encoding == gdk_atom_intern ("UTF8_STRING", FALSE))
+    {
+      return make_list ((gchar *)text, length, FALSE, list);
+    }
+  else
+    {
+      gchar **local_list;
+      gint local_count;
+      gint i;
+      gchar *charset = NULL;
+      gboolean need_conversion= g_get_charset (&charset);
+      gint count = 0;
+      GError *error = NULL;
+      
+      /* Probably COMPOUND text, we fall back to Xlib routines
+       */
+      local_count = gdk_text_property_to_text_list (encoding,
+                                                   format, 
+                                                   text,
+                                                   length,
+                                                   &local_list);
+      if (list)
+       *list = g_new (gchar *, local_count + 1);
+      
+      for (i=0; i<local_count; i++)
+       {
+         /* list contains stuff in our default encoding
+          */
+         if (need_conversion)
+           {
+             gchar *utf = g_convert (local_list[i], -1,
+                                     "UTF-8", charset,
+                                     NULL, NULL, &error);
+             if (utf)
+               {
+                 if (list)
+                   (*list)[count++] = utf;
+                 else
+                   g_free (utf);
+               }
+             else
+               {
+                 g_warning ("Error converting to UTF-8 from '%s': %s",
+                            charset, error->message);
+                 g_error_free (error);
+                 error = NULL;
+               }
+           }
+         else
+           {
+             if (list)
+               (*list)[count++] = g_strdup (local_list[i]);
+           }
+       }
+      
+      gdk_free_text_list (local_list);
+      (*list)[count] = NULL;
+
+      return count;
+    }
+}
+
+/* The specifications for COMPOUND_TEXT and STRING specify that C0 and
+ * C1 are not allowed except for \n and \t, however the X conversions
+ * routines for COMPOUND_TEXT only enforce this in one direction,
+ * causing cut-and-paste of \r and \r\n separated text to fail.
+ * This routine strips out all non-allowed C0 and C1 characters
+ * from the input string and also canonicalizes \r, \r\n, and \n\r to \n
+ */
+static gchar * 
+sanitize_utf8 (const gchar *src)
+{
+  gint len = strlen (src);
+  GString *result = g_string_sized_new (len);
+  const gchar *p = src;
+
+  while (*p)
+    {
+      if (*p == '\r' || *p == '\n')
+       {
+         p++;
+         if (*p == '\r' || *p == '\n')
+           p++;
+
+         g_string_append_c (result, '\n');
+       }
+      else
+       {
+         gunichar ch = g_utf8_get_char (p);
+         char buf[7];
+         gint buflen;
+         
+         if (!((ch < 0x20 && ch != '\t') || (ch >= 0x7f && ch < 0xa0)))
+           {
+             buflen = g_unichar_to_utf8 (ch, buf);
+             g_string_append_len (result, buf, buflen);
+           }
+
+         p = g_utf8_next_char (p);
+       }
+    }
+
+  return g_string_free (result, FALSE);
+}
+
+/**
+ * gdk_utf8_to_string_target:
+ * @str: a UTF-8 string
+ * 
+ * Convert an UTF-8 string into the best possible representation
+ * as a STRING. The representation of characters not in STRING
+ * is not specified; it may be as pseudo-escape sequences
+ * \x{ABCD}, or it may be in some other form of approximation.
+ * 
+ * Return value: the newly allocated string, or %NULL if the
+ *               conversion failed. (It should not fail for
+ *               any properly formed UTF-8 string.)
+ **/
+gchar *
+gdk_utf8_to_string_target (const gchar *str)
+{
+  GError *error = NULL;
+  
+  gchar *tmp_str = sanitize_utf8 (str);
+  gchar *result =  g_convert_with_fallback (tmp_str, -1,
+                                           "ISO-8859-1", "UTF-8",
+                                           NULL, NULL, NULL, &error);
+  if (!result)
+    {
+      g_warning ("Error converting from UTF-8 to STRING: %s",
+                error->message);
+      g_error_free (error);
+    }
+  
+  g_free (tmp_str);
+  return result;
+}
+
+/**
+ * gdk_utf8_to_compound_text:
+ * @str:      a UTF-8 string
+ * @encoding: location to store resulting encoding
+ * @format:   location to store format of the result
+ * @ctext:    location to store the data of the result
+ * @length:   location to store the length of the data
+ *            stored in @ctext
+ * 
+ * Convert from UTF-8 to compound text. 
+ * 
+ * Return value: %TRUE if the conversion succeeded, otherwise
+ *               false.
+ **/
+gboolean
+gdk_utf8_to_compound_text (const gchar *str,
+                          GdkAtom     *encoding,
+                          gint        *format,
+                          guchar     **ctext,
+                          gint        *length)
+{
+  gboolean need_conversion;
+  gchar *charset;
+  gchar *locale_str, *tmp_str;
+  GError *error = NULL;
+  gboolean result;
+
+  g_return_val_if_fail (str != NULL, FALSE);
+
+  need_conversion = g_get_charset (&charset);
+
+  tmp_str = sanitize_utf8 (str);
+
+  if (need_conversion)
+    {
+      locale_str = g_convert_with_fallback (tmp_str, -1,
+                                           charset, "UTF-8",
+                                           NULL, NULL, NULL, &error);
+      g_free (tmp_str);
+
+      if (!locale_str)
+       {
+         g_warning ("Error converting from UTF-8 to '%s': %s",
+                    charset, error->message);
+         g_error_free (error);
+
+         if (encoding)
+           *encoding = GDK_NONE;
+         if (format)
+           *format = GDK_NONE;
+         if (ctext)
+           *ctext = NULL;
+         if (length)
+           *length = 0;
+
+         return FALSE;
+       }
+    }
+  else
+    locale_str = tmp_str;
+    
+  result = gdk_string_to_compound_text (locale_str,
+                                       encoding, format, ctext, length);
+  
+  g_free (locale_str);
+
+  return result;
+}
index 9aa3c940bb24d5332c51c9ee6e45efe1375462c9..f686bc926d94fda29dda20e7e2d351d42cd0c855 100755 (executable)
@@ -18,6 +18,7 @@ EXPORTS
        GTK_TYPE_CTREE_POS
        GTK_TYPE_CURVE_TYPE
        GTK_TYPE_DEBUG_FLAG
+       GTK_TYPE_DELETE_TYPE
        GTK_TYPE_DEST_DEFAULTS
        GTK_TYPE_DIRECTION_TYPE
        GTK_TYPE_FUNDAMENTAL_TYPE
@@ -71,11 +72,13 @@ EXPORTS
        GTK_TYPE_GDK_WINDOW_TYPE
        GTK_TYPE_GDK_WM_DECORATION
        GTK_TYPE_GDK_WM_FUNCTION
+       GTK_TYPE_IMAGE_TYPE
        GTK_TYPE_JUSTIFICATION
        GTK_TYPE_MATCH_TYPE
        GTK_TYPE_MENU_DIRECTION_TYPE
        GTK_TYPE_MENU_FACTORY_TYPE
        GTK_TYPE_METRIC_TYPE
+       GTK_TYPE_MOVEMENT_STEP
        GTK_TYPE_OBJECT_FLAGS
        GTK_TYPE_ORIENTATION
        GTK_TYPE_PACKER_OPTIONS
@@ -106,9 +109,7 @@ EXPORTS
        GTK_TYPE_SUBMENU_PLACEMENT
        GTK_TYPE_TARGET_FLAGS
        GTK_TYPE_TEXT_DIRECTION
-       GTK_TYPE_TEXT_VIEW_DELETE_TYPE
-       GTK_TYPE_TEXT_VIEW_MOVEMENT_STEP
-       GTK_TYPE_TEXT_VIEW_SCROLL_TYPE
+       GTK_TYPE_TEXT_WINDOW_TYPE
        GTK_TYPE_TOOLBAR_CHILD_TYPE
        GTK_TYPE_TOOLBAR_SPACE_STYLE
        GTK_TYPE_TOOLBAR_STYLE
@@ -1104,6 +1105,8 @@ EXPORTS
        gtk_target_list_unref
        gtk_tearoff_menu_item_get_type
        gtk_tearoff_menu_item_new
+       gtk_text_attributes_new
+       gtk_text_attributes_unref
        gtk_text_backward_delete
        gtk_text_buffer_apply_tag
        gtk_text_buffer_apply_tag_by_name
@@ -1118,12 +1121,13 @@ EXPORTS
        gtk_text_buffer_create_tag
        gtk_text_buffer_delete_mark
        gtk_text_buffer_get_bounds
+       gtk_text_buffer_get_insert
        gtk_text_buffer_get_last_iter
        gtk_text_buffer_get_mark
        gtk_text_buffer_get_selection_bounds
        gtk_text_buffer_get_slice
        gtk_text_buffer_insert
-       gtk_text_buffer_insert_pixmap
+       gtk_text_buffer_insert_pixbuf
        gtk_text_buffer_modified
        gtk_text_buffer_move_mark
        gtk_text_buffer_new
@@ -1141,6 +1145,8 @@ EXPORTS
        gtk_text_iter_forward_line
        gtk_text_iter_forward_search
        gtk_text_iter_equal
+       gtk_text_iter_get_attributes
+       gtk_text_iter_get_line
        gtk_text_iter_get_offset
        gtk_text_iter_get_text
        gtk_text_iter_is_last
@@ -1157,12 +1163,19 @@ EXPORTS
        gtk_text_thaw
        gtk_text_unknown_char
        gtk_text_unknown_char_utf8
+       gtk_text_view_buffer_to_window_coords
+       gtk_text_view_get_buffer
+       gtk_text_view_get_line_at_y
+       gtk_text_view_get_line_yrange
        gtk_text_view_get_type
+       gtk_text_view_get_window
        gtk_text_view_get_wrap_mode
        gtk_text_view_new_with_buffer
+       gtk_text_view_set_border_window_size
        gtk_text_view_set_cursor_visible
        gtk_text_view_set_editable
        gtk_text_view_set_wrap_mode
+       gtk_text_view_window_to_buffer_coords
        gtk_timeout_add
        gtk_timeout_add_full
        gtk_timeout_remove
index 6df1843cfb065e670b35f64941477f156a1eaec5..3c7ff99e3392b7248c4d3e5d90e440457ad0b53c 100644 (file)
 #include "x11/gdkx.h"
 #endif
 
+#ifdef GDK_WINDOWING_WIN32
+#include "win32/gdkwin32.h"
+#endif
+
 typedef struct _RequestContentsInfo RequestContentsInfo;
 typedef struct _RequestTextInfo RequestTextInfo;
 
@@ -207,7 +211,11 @@ clipboard_get_timestamp (GtkClipboard *clipboard)
   
   if (timestamp == GDK_CURRENT_TIME)
     {
+#ifdef GDK_WINDOWING_X11
       timestamp = gdk_x11_get_server_time (clipboard_widget->window);
+#elif defined GDK_WINDOWING_WIN32
+      timestamp = GetMessageTime ();
+#endif
     }
   else
     {
index 23d32b616bf9afdc45bd884953b0c838c63bee45..59ace1cdbf4059c9328655bdebbf37ba0c848386 100644 (file)
@@ -18,12 +18,13 @@ include ../build/win32/make.mingw
 
 ################################################################
 
-# Possibly override GTK+ version from build/win32/module.defs
+# Possibly override versions from build/win32/module.defs
 GTK_VER = @GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@
+GDK_PIXBUF_VER = @GDK_PIXBUF_MAJOR@.@GDK_PIXBUF_MINOR@
 
 GDK_LIBS = -L ../gdk -lgdk-win32-$(GTK_VER)
 GTK_LIBS = -L . -lgtk-win32-$(GTK_VER)
-GDK_PIXBUF_LIBS = -L ../gdk-pixbuf -lgdk_pixbuf-$(GTK_VER)
+GDK_PIXBUF_LIBS = -L ../gdk-pixbuf -lgdk_pixbuf-$(GDK_PIXBUF_VER)
 
 # Perl and awk are needed to generate some source files.
 # These generated source files are distributed with the Win32 GTk+ source
@@ -68,6 +69,7 @@ gtk_OBJECTS =                                 \
        gtkcalendar.o                           \
        gtkcheckbutton.o                        \
        gtkcheckmenuitem.o                      \
+       gtkclipboard.o                          \
        gtkclist.o                              \
        gtkcolorsel.o                           \
        gtkcolorseldialog.o                     \
@@ -97,6 +99,7 @@ gtk_OBJECTS =                                 \
        gtkhscrollbar.o                         \
        gtkhseparator.o                         \
        gtkhsv.o                                \
+       gtkiconfactory.o                        \
        gtkimage.o                              \
        gtkimcontext.o                          \
        gtkimcontextsimple.o                    \
@@ -142,6 +145,7 @@ gtk_OBJECTS =                                       \
        gtkspinbutton.o                         \
        gtkstyle.o                              \
        gtkstatusbar.o                          \
+       gtkstock.o                              \
        gtktable.o                              \
        gtktearoffmenuitem.o                    \
        gtktext.o                               \
@@ -409,13 +413,13 @@ testselection.o : testselection.c
        $(CC) $(CFLAGS) -UGTK_COMPILATION -c -DG_LOG_DOMAIN=\"testselection\" testselection.c
 
 testtext.exe : testtext.o
-       $(CC) $(CFLAGS) -o $@  testtext.o $(GTK_LIBS) $(GDK_LIBS) $(GLIB_LIBS) $(LDFLAGS)
+       $(CC) $(CFLAGS) -o $@  testtext.o $(PANGO_LIBS) $(GDK_PIXBUF_LIBS) $(GTK_LIBS) $(GDK_LIBS) $(GLIB_LIBS) $(LDFLAGS)
 
 testtext.o : testtext.c
        $(CC) $(CFLAGS) -UGTK_COMPILATION -c -DG_LOG_DOMAIN=\"testtext\" testtext.c
 
 testtextbuffer.exe : testtextbuffer.o
-       $(CC) $(CFLAGS) -o $@  testtextbuffer.o $(GTK_LIBS) $(GDK_LIBS) $(GLIB_LIBS) $(LDFLAGS)
+       $(CC) $(CFLAGS) -o $@  testtextbuffer.o $(GDK_PIXBUF_LIBS) $(GTK_LIBS) $(GDK_LIBS) $(GLIB_LIBS) $(LDFLAGS)
 
 testtextbuffer.o : testtextbuffer.c
        $(CC) $(CFLAGS) -UGTK_COMPILATION -c -DG_LOG_DOMAIN=\"testtextbuffer\" testtextbuffer.c
@@ -440,4 +444,6 @@ rmgen:
 # makefile.mingw.in. Only for developer use.
 makefile.mingw: makefile.mingw.in
        sed -e 's,@GTK_MAJOR[_]VERSION@,@GTK_MAJOR_VERSION@,' \
-           -e 's,@GTK_MINOR[_]VERSION@,@GTK_MINOR_VERSION@,' <$< >$@
+           -e 's,@GTK_MINOR[_]VERSION@,@GTK_MINOR_VERSION@,' \
+           -e 's,@GDK_PIXBUF[_]MAJOR@,@GDK_PIXBUF_MAJOR@,'   \
+           -e 's,@GDK_PIXBUF[_]MINOR@,@GDK_PIXBUF_MINOR@,'     <$< >$@